<template>
	<div class="container" style="padding:0;height: 100%;">
		<el-row :gutter="20" style='height: 100%;'>
			<!-- tree树形控件 -->
			<el-col :span="4" :xs="24" style='padding-right:0;height: 100%;'>
				<el-card style='height: 100%'>
					<!-- search -->
					<div class="head-container">
						<el-input v-model="deptName" placeholder="请输入设备" clearable prefix-icon="el-icon-search"
							style="margin-bottom: 20px" />
					</div>
					<!-- treeselect -->
					<el-scrollbar style="height:78.5vh;">
						<el-tree :data="deptOptions" :props="defaultProps" show-checkbox :expand-on-click-node="false"
							:filter-node-method="filterNode" ref="tree" :check-on-click-node='true' show-file-list
							node-key="id" :default-expanded-keys="expandedKeys" @node-click="handleNodeClick"
							accordion highlight-current />
					</el-scrollbar>
				</el-card>
			</el-col>
			<el-col :span="20" :xs="24">
				<div>
					<div class="mytree">
						<el-dialog title="扫描扩展参数" :visible.sync="dialogVisible1" width="500px">
							<ul style="width: 100%;">
								<el-checkbox v-model="checked5">是否扩展时钟</el-checkbox>
								<li v-for="(item,index) in extendArr" :key='index' style="width: 100%;">
									<div v-if='item.options' style="width: 100%;margin-top: 5px;">
										<span style="display: inline-block;width:40%;">{{item.title}}</span>
										<el-select v-model="item.checks" placeholder="请选择">
											<el-option v-for="items in item.options" :key="items.value"
												:label="items.label" :value="items.value">
											</el-option>
										</el-select>
									</div>
									<div v-else style="width: 100%;margin-top: 5px;">
										<span style="display: inline-block;width:53%;">{{item.title}}</span>
										<!-- <el-input type='number' v-model="item.value" style='width: 36.8%;' @input="changeInput(item.value,index)"></el-input> -->
										<el-input-number v-model="item.value" controls-position="right" :min="item.min"
											:max="item.max" style='width: 36.8%;'></el-input-number>
									</div>
								</li>
							</ul>
							<span slot="footer" class="dialog-footer">
								<el-button type="primary" @click="ddssf">确 定</el-button>
								<el-button @click="dialogVisible1 = false">取 消</el-button>
							</span>
						</el-dialog>
					</div>
					<el-tabs v-model="activeName" @tab-click="handleClick">
						<el-tab-pane label="屏幕设置" name="first">
							<div class="confCss">
								<div class="configBox screenBasic" style="margin-top:5px;">
									<span class="titleLei">操作</span>
									<div class="divBox">
										<el-select v-model="value" placeholder="请选择操作" style="width: 35%;">
											<el-option v-for="item in options" :key="item.value" :label="item.label"
												:value="item.command">
											</el-option>
										</el-select>
										<el-button class="sendBtn" style="margin-left: 15px;" type="success"
											@click="operates()">确定</el-button>
									</div>
								</div>
								<div class="configBox screenBasic">
									<span class="titleLei">基本参数</span>
									<ul class="ulbox">
										<li>
											<span>屏类型</span>
											<el-select v-model="screenValue" placeholder="请选择操作"
												style="width: 20%;margin-left:10px">
												<el-option v-for="item in screenType" :key="item.value"
													:label="item.label" :value="item.value">
												</el-option>
											</el-select>
											<el-checkbox v-model="checked1" style="margin-left: 15px;">OE反向
											</el-checkbox>
											<el-checkbox v-model="checked2">数据反向</el-checkbox>
											<el-checkbox v-model="checked3">数据字节逆序</el-checkbox>
											<el-checkbox v-model="checked4" @change="isextend">设置扩展参数</el-checkbox>
										</li>
										<li>
											<span style="margin-left: 15px;">宽度</span>
											<el-input-number v-model="numWidth" controls-position="right" :min="16"
												:max="999"></el-input-number>
											<span style="margin-left: 15px;">高度</span>
											<el-input-number v-model="numHeight" controls-position="right" :min="16"
												:max="999"></el-input-number>
											<span style="margin-left: 15px;">节目数量</span>
											<el-input-number v-model="programNum" controls-position="right" :min="0"
												:max="127"></el-input-number>
											<el-button @click="extendConfig" type="success" style="margin-left: 25px;"
												v-show="isextendConfig">扩展参数</el-button>
											<el-button @click="basicBtn" type="success" style="margin-left: 25px;">设置
											</el-button>
										</li>
									</ul>
								</div>
								<div class="configBox screenBasic">
									<span class="titleLei">扫描配置</span>
									<div class="divBox btlv">
										<p>
											<span style="width: 12%;">扫描方式</span>
											<el-select v-model="valueSmfs" placeholder="请选择操作"
												style="width: 85%;margin-left:5px">
												<el-option v-for="(item,index) in optionsSmfs" :key="item.scanId"
													:label="item.scanName" :value="item.scanId"
													@click.native="changeScanType(index)">
												</el-option>
											</el-select>
										</p>
										<p style="width:100%">
											<span style="width:12%;">行消隐</span>
											<el-select v-model="valueHxy" placeholder="请选择操作"
												style="width:18%;margin-left:5px">
												<el-option v-for="(item,index) in optionsHxy" :key="item.value"
													:label="item.label" :value="index"
													@click.native="changeLineShadow(index)">
												</el-option>
											</el-select>
											<span style="margin-left: 10px;width: 12%;">行顺序</span>
											<el-select v-model="valueHsx" placeholder="请选择操作"
												style="width:18%;margin-left:5px">
												<el-option v-for="(item,index) in optionsHsx" :key="item.value"
													:label="item.label" :value="index"
													@click.native="changeRowOrder(index)">
												</el-option>
											</el-select>
											<span style="width: 12%;">点阵</span>
											<el-select v-model="valueDz" placeholder="请选择操作"
												style="width:18%;margin-left:5px">
												<el-option v-for="(item,index) in optionsDz" :key="item.value"
													:label="item.label" :value="index"
													@click.native="changeRgOrder(index)">
												</el-option>
											</el-select>
										</p>
										<p style="width:100%">
											<span style="width: 12%;">数据类型</span>
											<el-select v-model="valueSjlx" placeholder="请选择操作"
												style="width:18%;margin-left:5px">
												<el-option v-for="(item,index) in optionsSjlx" :key="item.value"
													:label="item.label" :value="index"
													@click.native="changeMirror(index)">
												</el-option>
											</el-select>
											<span style="margin-left: 10px;width: 12%;">138译码</span>
											<el-select v-model="valueYm" placeholder="请选择操作"
												style="width:18%;margin-left:5px">
												<el-option v-for="(item,index) in optionsYm" :key="item.value"
													:label="item.label" :value="index"
													@click.native="changeDecoding(index)">
												</el-option>
											</el-select>
											<el-button class="sendBtn" type="success" @click="scanBtn()"
												style="width: 20%;margin-left: 40px;padding: 10px;">设置</el-button>
										</p>
									</div>
								</div>
								<!-- <div class="configBox screenBasic" style="margin-top:5px;">
									<span class="titleLei">其他升级</span>
									<div style="margin-top: 5px;">
										<el-radio-group v-model="radio" size="medium" @change='historyBtn'>
										      <el-radio-button label="本地文件" ></el-radio-button>
										      <el-radio-button label="历史文件" ></el-radio-button>
										</el-radio-group>	  
										<el-button class="sendBtn" style="margin-left: 15px;" type="success" @click="qitaBtn()">发送</el-button>
										<div style="padding: 5px;border: 1px solid gray;height: 120px;">
											<div v-if="radio=='本地文件'" >
												<ul style="display: flex;flex-wrap: wrap;">
													<li v-for="(item,index) in benFileArr" :key='index' style="width: 50%;margin-top: 3px;display: flex;align-items: center;" @click='benFileIndex(index)'>
														<el-upload class="upload-demo"
															action=""
															:accept="item.suffix"
															:before-upload="beforeBenUpload">
															<el-button size="small" type="primary" >{{item.title}}</el-button>
														</el-upload>
														<span v-show="item.isgjShowBen" style="font-size:13px;font-weight:400;color:#fff;margin-left: 2px;">
															   {{item.urlFileBen}}
															<span style="color:red;cursor:pointer;" @click="deleteFileUrl(index)">x</span>
														</span>
														
													</li>
												</ul>
											</div>
											<div v-if="radio=='历史文件'">
												<ul style="display: flex;flex-wrap: wrap;">
													<li style="width: 50%;">
														<el-select v-model="value" placeholder="">
														    <el-option
														      v-for="item in options"
														      :key="item.value"
														      :label="item.label"
														      :value="item.value">
														    </el-option>
														</el-select>
													</li>
												</ul>
											</div>
										</div>
									</div>
								</div> -->
              </div>
            </el-tab-pane>
            <el-tab-pane label="串口设置" name="second">
              <div class="mytree">
                <el-dialog
                  :title="fileTitle"
                  :visible.sync="dialogVisible"
                  width="600px"
                >
                  <div
                    style="height:75vh;overflow:auto;background-color: lightgray;padding: 10px;"
                  >
                   <el-radio
                      v-model="radio1"
                      v-for="(item, index) in binFileArr"
                      :key="item.fUuid"
                      :label="index + 1"
                      @change="radioChange(index)"
                      style="border-bottom:1px solid gray;width:90%;margin-top:10px"
                    >
                      {{ item.fDescription }}
					  </el-radio>
					<!-- <div v-for="(item, index) in binFileArr" style="border-bottom:1px solid gray;width:90%;height: 80px;display: flex;justify-content: space-between;align-items: center;"> 
						  <el-radio
						    v-model="radio1"
						    :key="item.fUuid"
						    :label="index + 1"
						    @change="radioChange(index)" 
							style='width: 60px'>
						   </el-radio>
						   <p style="width: 200px">{{ item.fDescription }}</p>
						   <p style="width: 150px"> {{ item.createTime }}</p>
					  </div> -->
                  </div>
                  <span slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="serverFileOk" :disabled="isButton"
                      >确 定</el-button
                    >
                    <!-- <el-button @click="dialogVisible = false">取 消</el-button> -->
                    <el-button
                      type="primary"
                      @click="deleteFile"
                      :disabled="isButton"
                      >删 除
                    </el-button>
                  </span>
                </el-dialog>
              </div>
              <div class="confCss">
                <div style="display: flex;justify-content: space-between;">
                  <div style="width: 38%;">
                    <div class="configBox" style="width: 100%;">
                      <span class="titleLei">升级</span>
                      <div class="divBox">
                        <span>固件升级：</span>
                        <el-upload
                          class="upload-demo"
                          :accept="suffix"
                          :limit="1"
                          action=""
                          :before-upload="beforegjUpload"
                        >
                          <el-button size="small" type="primary"
                            >本地文件</el-button
                          >
                        </el-upload>
                        <el-button
                          class="sendBtn"
                          type="primary"
                          style="margin-left: 5px;"
                          @click="serverFile(1)"
                          >服务器文件</el-button
                        >
                        <el-button
                          class="sendBtn"
                          type="success"
                          @click="sendgjFile"
                          >发送
                        </el-button>
                        <p
                          v-show="isgjShow"
                          style="font-size: 13px;font-weight:400"
                        >
                          上传文件名：{{ urlFile }}
                        </p>
                      </div>
                      <div class="divBox">
                        <span>字库升级：</span>
                        <el-upload
                          class="upload-demo"
                          action=""
                          :accept="suffix"
                          :before-upload="beforezkUpload"
                        >
                          <el-button size="small" type="primary"
                            >本地文件</el-button
                          >
                        </el-upload>
                        <el-button
                          class="sendBtn"
                          style="margin-left: 5px;"
                          type="primary"
                          @click="serverFile(2)"
                          >服务器文件</el-button
                        >
                        <el-button
                          class="sendBtn"
                          type="success"
                          @click="sendFile()"
                          >发送
                        </el-button>
                        <p
                          v-show="iszkShow"
                          style="font-size: 13px;font-weight:400"
                        >
                          上传文件名:
                        </p>
                      </div>
                    </div>
                    <div class="configBox" style="width: 100%;">
                      <span class="titleLei">波特率配置</span>
                      <div class="divBox btlv">
                        <p>
                          <span>通信地址</span>
                          <el-input
                            v-model="inputNum"
                            placeholder="请输入内容"
                          ></el-input>
                        </p>
                        <p>
                          <span>波特率</span>
                          <el-select
                            v-model="valueBtl"
                            placeholder="请选择操作"
                            style="width: 65%;margin-left:20px"
                          >
                            <el-option
                              v-for="item in optionsBtl"
                              :key="item.value"
                              :label="item.label"
                              :value="item.label"
                            >
                            </el-option>
                          </el-select>
                        </p>
                        <p>
                          <span>等待时间</span>
                          <el-input-number
                            v-model="num"
                            controls-position="right"
                            @change="handleTimeChange"
                            :min="1"
                            :max="15"
                          ></el-input-number>
                          <el-button
                            class="sendBtn"
                            type="success"
                            @click="btvBtn()"
                            >设置
                          </el-button>
                        </p>
                      </div>
                    </div>
                  </div>
                  <div style="width: 60%;">
                    <div class="configBox" style="width: 100%;">
                      <span class="titleLei">GPRS参数设置</span>
                      <div class="divBox btlv">
                        <p>
                          <span style="width: 14%;">服务器类型</span>
                          <el-select
                            v-model="valueFwq"
                            style="width: 30%;margin-left: 5px;"
                          >
                            <el-option
                              v-for="(item, index) in optionsFwq"
                              :key="item.value"
                              :label="item.label"
                              :value="item.value"
                              @click.native="changeServerType(index)"
                            >
                            </el-option>
                          </el-select>
                          <span style="margin-left: 20px;width: 14%;">服务器IP</span>
                          <el-input
                            v-model="inputFwq"
                            :disabled="fwqDisabled"
                            style="width: 30%;margin-left: 5px;"
                            @blur="fwqReg"
                          ></el-input>
                        </p>
                        <p>
                          <span style="width: 14%;">端口号</span>
                          <el-input
                            v-model="inputDkh"
                            style="width: 30%;margin-left: 5px;"
                            @blur="dkhReg"
                          ></el-input>
                          <span style="margin-left: 20px;width: 14%;">域名</span>
                          <el-input
                            v-model="inputDns"
                            :disabled="dnsDisabled"
                            style="width: 30%;margin-left: 5px;"
                            @blur="dnsReg"
                          ></el-input>
                        </p>
                        <p>
                          <span style="width: 14%;">APN</span>
                          <el-input
                            v-model="inputApn"
                            style="width: 30%;margin-left: 5px;"
                          >
                          </el-input>
                          <span style="margin-left: 20px;width: 14%;">APN用户</span>
                          <el-input
                            v-model="inputApnyh"
                            style="width: 30%;margin-left: 5px;"
                          >
                          </el-input>
                        </p>
                        <p>
                          <span style="width: 14%;">APN密码</span>
                          <el-input
                            v-model="inputApnmm"
                            style="width: 30%;margin-left: 5px;"
                          >
                          </el-input>
                          <el-checkbox
                            v-model="checked"
                            border
                            style="color: #fff;font-weight: 700;background-color: #000;margin-left: 50px;"
                          >
                            4G</el-checkbox
                          >
                          <!-- <el-button class="sendBtn" type="warning" @click="sendFile()">回读</el-button> -->
                          <el-button
                            class="sendBtn"
                            type="success"
                            @click="gprsBtn()"
                            >设置
                          </el-button>
                        </p>
                        <div
                          style="border-top: 1px solid #fff;margin-top: 10px;background-color: #f0f8ff;color: #000000;font-size: 14px;font-weight: 400;padding: 5px;"
                        >
                          注意：<br />
                          只有GPRS无限卡、4G卡、3G卡才能设置用此部分功能,否则对于其他进行了设置,则不能正常运行。
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="configBox" style="margin-top:15px;">
                  <span class="titleLei">屏幕亮度设置</span>
                  <div
                    class="timeBox"
                    style="display: flex;flex-wrap: wrap;align-items: center;"
                  >
                    <span>有效时间个数</span>
                    <el-select
                      v-model="timeNumValue"
                      style="width: 10%;margin-left:15px"
                    >
                      <el-option
                        v-for="(item, index) in setTimeArr"
                        :key="item.value"
                        :label="item.label"
                        :value="item.label"
                        @click.native="changeTime(index)"
                      >
                      </el-option>
                    </el-select>
                    <el-button
                      type="success"
                      style="margin-left: 20px;"
                      @click="brightnessBtn"
                      >设置
                    </el-button>
                    <span style="color: red;margin-left: 10px;margin-right:3%;">
                      (注：一个不用设置时间，下发立刻执行)
                    </span>
                    <div
                      style="width:31%;margin-top: 10px;margin-right: 12px;"
                      v-for="(item, index) in setTimeLength.lightInfos"
                      :key="index"
                    >
                      <span style="width: 12%;margin-right: 5px;">定时{{ index + 1 }}</span>
                      <el-time-picker
                        style="width: 33%;"
                        v-model="item.start"
                        placeholder="选时间"
                        format="HH:mm"
                        value-format="HH:mm"
                        @change="judgeTime(index)"
                      >
                      </el-time-picker>
                      <span style="width: 12%;margin-left: 10px;margin-right: 5px;">亮度{{ index + 1 }}</span>
                      <el-input-number
                        v-model="item.bright"
                        controls-position="right"
                        :min="0"
                        :max="15"
                        style="width: 30%;"
                      ></el-input-number>
                    </div>
                  </div>
                </div>
                <div class="configBox" style="margin-top:15px;">
                  <span class="titleLei">开关屏设置</span>
                  <div class="timeBox">
                    <span>有效时间个数</span>
                    <el-select
                      v-model="timeNumValue2"
                      style="width: 20%;margin-left:10px"
                    >
                      <el-option
                        v-for="(item, index) in setTimeArr"
                        :key="item.value"
                        :label="item.label"
                        :value="item.label"
                        @click.native="onoffchangeTime(index)"
                      >
                      </el-option>
                    </el-select>
                    <el-button
                      type="success"
                      style="margin-left: 15px;"
                      @click="onoffBtn"
                      >设置
                    </el-button>
                    <span style="color: red;margin-left: 10px;">(注：设置的时间段是设备开屏时间,其他时间都是关屏)</span>
                    <div style="display: flex;flex-wrap: wrap;">
                      <div
                        style="width:50%;margin-top: 10px;"
                        v-for="(items, index) in onoffTimeLength"
                        :key="index"
                      >
                        <span>时段{{ index + 1 }}</span>
                        <el-time-picker
                          style="width: 60%;margin-left: 10px;"
                          is-range
                          v-model="items.times"
                          range-separator="至"
                          start-placeholder="开始时间"
                          end-placeholder="结束时间"
                          placeholder="选择时间范围"
                          format="HH:mm"
                          value-format="HH:mm"
                          @change="onofftime(index)"
                        >
                        </el-time-picker>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
            <el-tab-pane label="车载设置" name="third">
              <div class="confCss">
                <div
                  class="configBox screenBasic"
                  style="margin-top:5px;width: 80%;"
                >
                  <span class="titleLei">星级设置</span>
                  <ul class="divBox2">
                    <li>
                      <el-checkbox v-model="checked">五星评分</el-checkbox>
                      <el-select
                        v-model="starObj.checks"
                        style="width: 15%;margin-left: 5px;"
                      >
                        <el-option
                          v-for="(items, index) in starObj.starArr"
                          :key="items.value"
                          :label="items.label"
                          :value="items.value"
                          @click.native="starChange(index)"
                        >
                        </el-option>
                      </el-select>
                      <el-button
                        type="success"
                        style="margin-left: 20px;"
                        @click="starColorBtn"
                      >
                        设置</el-button
                      >
                    </li>
                    <li style="display:flex;margin-top:5px;">
                      <div
                        v-for="(item, index) in starColorArr"
                        :key="index"
                        style="width: 20%"
                      >
                        <span>{{ index + 1 }}星</span>
                        <el-select
                          v-model="starColorData[index]"
                          style="width: 70%;margin-left: 5px;"
                        >
                          <el-option
                            v-for="items in colorOptions"
                            :key="items.label"
                            :label="items.label"
                            :value="items.colors"
                          >
                          </el-option>
                        </el-select>
                      </div>
                    </li>
                    <li style="margin-top: 5px;">
                      <span>星级设置</span>
                      <el-select
                        v-model="starObj.starValue"
                        style="width: 20%;margin-left: 5px;"
                      >
                        <el-option
                          v-for="items in starObj.starArr"
                          :key="items.label"
                          :label="items.label"
                          :value="items.value"
                        >
                        </el-option>
                      </el-select>
                      <el-button
                        type="success"
                        style="margin-left: 20px;"
                        @click="starArrBtn"
                        >设置
                      </el-button>
                    </li>
                  </ul>
                </div>
                <div
                  class="configBox screenBasic"
                  style="margin-top:20px;width: 80%;"
                >
                  <span class="titleLei">报警设置</span>
                  <div class="divBox">
                    <div style="display: flex;align-items: center;width: 100%;">
                      <div style="width: 50%;">
                        <el-input
                          style="width: 95%;"
                          type="textarea"
                          :rows="4"
                          placeholder="请输入报警内容"
                          v-model="textarea"
                        >
                        </el-input>
                      </div>
                      <div>
                        <el-button type="danger" @click="callpolice"
                          >设置报警</el-button
                        ><br />
                        <el-button
                          type="warning"
                          @click="cancelpolice"
                          style="margin-top: 5px;"
                          >取消报警</el-button
                        >
                      </div>
                    </div>
                  </div>
                </div>
                <div
                  class="configBox screenBasic"
                  style="margin-top:20px;width: 80%;"
                >
                  <span class="titleLei">空车有客</span>
                  <div class="divBox">
                    <ul style="display: flex;width: 100%;flex-wrap: wrap;">
                      <li
                        v-for="(item, index) in catArr"
                        :key="item.text"
                        style="width: 33%;margin-bottom: 10px;"
                      >
                        <span
                          style="width: 33%;display: inline-block;text-align: right;font-weight: 700;"
                          >{{ item.text }}</span
                        >
                        <el-select
                          v-model="catColorData[index]"
                          style="width: 50%;margin-left: 5px;"
                        >
                          <el-option
                            v-for="items in colorOptions"
                            :key="items.value"
                            :label="items.label"
                            :value="items.colors"
                          >
                          </el-option>
                        </el-select>
                      </li>
                      <el-button
                        type="success"
                        style="width: 16%;margin-left: 12%;padding:10px;height: 35px;"
                        @click="catBtn"
                        >设置</el-button
                      >
                    </ul>
                  </div>
                </div>
              </div>
            </el-tab-pane>
          </el-tabs>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import {
  programsImg,
  delMaterial,
  getMaterial,
  cardSend,
  scanModeList
} from '@/api/system/program'
import { getDev } from '@/api/system/map'
import { mapState, mapMutations } from 'vuex'
import Treeselect from '@riophae/vue-treeselect' // import Treeselect component
import '@riophae/vue-treeselect/dist/vue-treeselect.css' // import Treeselect styles
import { treeselect } from '@/api/system/count' // import treeselect api
export default {
  name: 'ParmConfig',
  components: {
    Treeselect
  },
  data () {
    return {
      // 空车有客
      starObj: {
        checks: 1,
        starValue: 1,
        starArr: [
          {
            value: 1,
            label: '一星'
          },
          {
            value: 2,
            label: '二星'
          },
          {
            value: 3,
            label: '三星'
          },
          {
            value: 4,
            label: '四星'
          },
          {
            value: 5,
            label: '五星'
          }
        ]
      },
      starcolorObj: {
        checks: '红色'
      },
      starColorData: ['FF0000', 'FF0000', 'FF0000', 'FF0000', 'FF0000'],
      starColorArr: [
        {
          checks: '红色'
        }
      ],
      catColorData: [
        'FF0000',
        'FF0000',
        'FF0000',
        'FF0000',
        'FF0000',
        'FF0000',
        'FF0000',
        'FF0000'
      ],
      catArr: [
        {
          text: '空车',
          value: '红色'
        },
        {
          text: '有客',
          value: '红色'
        },
        {
          text: '电召',
          value: '红色'
        },
        {
          text: '交班',
          value: '红色'
        },
        {
          text: '停运',
          value: '红色'
        },
        {
          text: '报警求助',
          value: '红色'
        },
        {
          text: '和乘',
          value: '红色'
        },
        {
          text: '稽查',
          value: '红色'
        }
      ],

      // 屏幕设置
      benUrlIndex: -1,
      benFileArr: [
        {
          title: 'AP固件升级',
          suffix: '',
          urlFileBen: '',
          fUuid: '',
          isgjShowBen: false
        },
        {
          title: 'boot固件升级',
          suffix: '',
          urlFileBen: '',
          fUuid: '',
          isgjShowBen: false
        },
        {
          title: '出厂配置升级',
          suffix: '',
          urlFileBen: '',
          fUuid: '',
          isgjShowBen: false
        },
        {
          title: '4G固件升级',
          suffix: '',
          urlFileBen: '',
          fUuid: '',
          isgjShowBen: false
        },
        {
          title: '字库升级',
          suffix: '',
          urlFileBen: '',
          fUuid: '',
          isgjShowBen: false
        },
        {
          title: '开机画面升级',
          suffix: '',
          urlFileBen: '',
          fUuid: '',
          isgjShowBen: false
        }
      ],
      lightType: 1,
      isextendConfig: false,
      screenValue: 1,
      screenType: [
        {
          value: 1,
          label: '单色屏'
        },
        {
          value: 2,
          label: '双色屏'
        },
        {
          value: 3,
          label: '七彩屏'
        },
        {
          value: 4,
          label: '全彩屏'
        }
      ],
      checked1: false,
      checked2: false,
      checked3: false,
      checked4: false,
      numWidth: null,
      numHeight: null,
      programNum: null,
      timeNumValue: 1,
      setTimeArr: [
        {
          value: '0',
          label: 1
        },
        {
          value: '1',
          label: 2
        },
        {
          value: '2',
          label: 3
        },
        {
          value: '3',
          label: 4
        }
      ],
      setTimeLength: {
        lightType: 1,
        lightInfos: [
          {
            start: '',
            end: '',
            bright: 15
          }
        ]
      },
      timeNumValue2: 1,
      onoffTimeLength: [
        {
          start: '',
          end: ''
        }
      ],
      onoffTimeArr: [],
      checked5: false,
      extendArr: [
        {
          title: 'RGB顺序设置',
          checks: '0,1,2',
          options: [
            {
              // value:0,
              label: '红绿蓝',
              value: '0,1,2'
            },
            {
              // value:1,
              label: '红蓝绿',
              value: '0,2,1'
            },
            {
              // value:2,
              label: '绿红蓝',
              value: '1,0,2'
            },
            {
              // value:3,
              label: '绿蓝红',
              value: '1,2,0'
            },
            {
              // value:4,
              label: '蓝红绿',
              value: '2,0,1'
            },
            {
              // value:5,
              label: '蓝绿红',
              value: '2,1,0'
            }
          ]
        },
        {
          title: '行驱动芯片选择',
          checks: 0,
          options: [
            {
              value: 0,
              label: '默认列芯片'
            },
            {
              value: 1,
              label: '138'
            },
            {
              value: 2,
              label: '无138'
            },
            {
              value: 3,
              label: 'SM5266'
            },
            {
              value: 4,
              label: 'RT5958'
            },
            {
              value: 5,
              label: 'ICN2018'
            },
            {
              value: 6,
              label: 'SCAN5166'
            },
            {
              value: 7,
              label: '串行1'
            },
            {
              value: 8,
              label: '串行2'
            },
            {
              value: 9,
              label: '串行3'
            },
            {
              value: 10,
              label: '串行4'
            },
            {
              value: 11,
              label: '串行5'
            },
            {
              value: 12,
              label: '串行6'
            },
            {
              value: 13,
              label: '串行7'
            },
            {
              value: 14,
              label: '串行8'
            },
            {
              value: 15,
              label: '串行9'
            },
            {
              value: 16,
              label: '串行10'
            },
            {
              value: 17,
              label: '串行11'
            },
            {
              value: 18,
              label: '串行12'
            },
            {
              value: 19,
              label: 'tc7258'
            }
          ]
        },
        {
          title: '列驱动芯片选择',
          checks: 0,
          options: [
            {
              value: 0,
              label: '默认列芯片'
            },
            {
              value: 1,
              label: 'SM16207'
            },
            {
              value: 2,
              label: 'SM16227'
            },
            {
              value: 3,
              label: 'SM16237'
            },
            {
              value: 4,
              label: 'icn2038S/2045 CN'
            },
            {
              value: 5,
              label: 'ICN2053'
            },
            {
              value: 6,
              label: 'SUM2017'
            },
            {
              value: 7,
              label: 'MBI5024普通芯片'
            },
            {
              value: 8,
              label: 'FM6126A'
            },
            {
              value: 9,
              label: 'SM16159'
            },
            {
              value: 10,
              label: 'SM16259'
            },
            {
              value: 11,
              label: 'icn2055'
            },
            {
              value: 12,
              label: 'sum2035'
            }
          ]
        },
        {
          title: '灰度等级',
          checks: 12,
          options: [
            {
              value: 8,
              label: '256级'
            },
            {
              value: 12,
              label: '4096级'
            }
          ]
        },
        {
          title: '数据方向',
          checks: 0,
          options: [
            {
              value: 0,
              label: '从左到右'
            },
            {
              value: 1,
              label: '从右到左'
            }
          ]
        },
        {
          title: '时钟延迟(最小为4)',
          value: 4,
          max: 255,
          min: 4
        },
        {
          title: '时钟周期(3-15)',
          value: 5,
          max: 15,
          min: 3
        },
        {
          title: '时钟相位延时(0-7)',
          value: 0,
          max: 7,
          min: 0
        },
        {
          title: '设置消影时间（8 - 255）',
          value: 64,
          max: 255,
          min: 8
        },
        {
          title: '影响亮度有效率（2的n次方）',
          value: 4,
          max: 99,
          min: 0
        },
        {
          title: '设置刷新倍率（0, 1, 3,2n - 1）',
          value: 0,
          max: 999,
          min: 0
        }
      ],
      textarea: '',
      colorOptions: [
        {
          value: 0,
          label: '红色',
          colors: 'FF0000'
        },
        {
          value: 1,
          label: '绿色',
          colors: '00FF00'
        },
        {
          value: 2,
          label: '黄色',
          colors: 'FFFF00'
        },
        {
          value: 3,
          label: '蓝色',
          colors: '0000FF'
        },
        {
          value: 4,
          label: '紫色',
          colors: 'FF00FF'
        },
        {
          value: 5,
          label: '青色',
          colors: '00FFFF'
        },
        {
          value: 6,
          label: '白色',
          colors: 'FFFFFF'
        }
      ],

      // 串口设置
      fFileIdArr: [],
      isButton: true,
      isgjShow: false,
      // isgjShowBen:false,
      iszkShow: false,
      suffix: '.bin',
      suffix2: '.bin,.ini,.so',
      fileTitle: '',
      // form: {
      // 	deptId: undefined
      // },
      mapTreeData: [],
      quer2: {
        deptId: undefined,
        fType: 6
      },
      fwqDisabled: false,
      dnsDisabled: true,
      dialogVisible: false,
      dialogVisible1: false,
      deptOptions: undefined, // 部门树选项
      deptName: undefined, // 部门名称
      defaultProps: {
        children: 'children', // 指定子树为节点对象的某个属性值
        label: 'label' // 指定节点标签为节点对象的某个属性值
      },
      expandedKeys: [], //默认打开的节点

      activeName: 'first',
      activeNameed: '1',
      options: [
        {
          value: '选项1',
          label: '开屏',
          command: 19
        },
        {
          value: '选项2',
          label: '关屏',
          command: 18
        },
        {
          value: '选项3',
          label: '复位',
          command: 67
        },
        {
          value: '选项4',
          label: '清空节目',
          command: 46
        },
        {
          value: '选项5',
          label: '服务器校时',
          command: 20
        },
        {
          value: '选项6',
          label: '回读',
          command: 30
        }
        // ,{
        // 	value: '选项7',
        // 	label:  '格式化',
        // 	command:242
        // },
      ],
      value: '',
      inputNum: 255,
      valueBtl: 115200,
      optionsBtl: [
        {
          value: '选项1',
          label: 9600
        },
        {
          value: '选项2',
          label: 28800
        },
        {
          value: '选项3',
          label: 57600
        },
        {
          value: '选项4',
          label: 115200
        }
      ],
      radio1: 0,
      radio: '本地文件',
      num: 2,
      valueSmfs: '',
      optionsSmfs: [],

      valueHxy: '正常',
      optionsHxy: [
        {
          value: '选项1',
          label: '正常'
        },
        {
          value: '选项2',
          label: '加长'
        },
        {
          value: '选项3',
          label: '超长'
        }
      ],
      basicArr: [0, 0, 1, 2, 3, 0, 0, 4, 12, 5, 0, 0, 0, 64, 0, 0, 4],
      isA: false,
      isB: false,

      valueHsx: '+1',
      optionsHsx: [
        {
          value: '选项1',
          label: '+1'
        },
        {
          value: '选项2',
          label: '标准'
        },
        {
          value: '选项3',
          label: '-1'
        }
      ],

      valueDz: 'R+G',
      optionsDz: [
        {
          value: '选项1',
          label: 'R+G'
        },
        {
          value: '选项2',
          label: 'G+R'
        }
      ],

      valueSjlx: '正常',
      optionsSjlx: [
        {
          value: '选项1',
          label: '正常'
        },
        {
          value: '选项2',
          label: '镜像'
        }
      ],

      valueYm: 'YES',
      optionsYm: [
        {
          value: '选项1',
          label: 'YES'
        },
        {
          value: '选项2',
          label: '无'
        }
      ],

      valueFwq: '固定IP',
      optionsFwq: [
        {
          value: '选项1',
          label: '固定IP'
        },
        {
          value: '选项2',
          label: '域名'
        }
      ],
      inputFwq: '',
      inputDkh: '',
      inputDns: '',
      inputApn: 'cmiot',
      inputApnyh: '',
      inputApnmm: '',
      checked: false,
      sendConfig: {
        cardList: []
      },
      urlFile: '',
      query2: {
        cardList: [],
        command: 65,
        fUuid: ''
      },
      query3: {
        cardList: [],
        command: 65,
        fUuid: ''
      },
      binFileArr: [],
      fUuid: undefined,
      tiurlFile: undefined,
      scanConfig: {
        lineShadow: 0,
        rowOrder: 0,
        rgOrder: 0,
        mirror: 0,
        decoding: 0,
        scanType: 0,
        pointFreq: 0,
        scanType: '',
        subScanType: ''
      },
      gprsConfig: {
        apn: 'cmiot', //APN
        userName: '',
        password: '',
        dns: '',
        domain: '',
        port: '', //端口号
        inType: '0', //服务器类型
        is4G: '0' //4G选择
      }
    }
  },
  watch: {
    // 根据名称筛选部门树
    deptName (val) {
      this.$refs.tree.filter(val)
    },
    deptOptions: {
      handler () {
        this.deptOptions.forEach(item => {
          this.expandedKeys.push(item.id)
        })
      },
      deep: true
    },
    // 监听deptId
    // 'form.deptId': 'currDeptChange',
    '$store.state.deptId': {
      handler (newval) {
        this.quer2.deptId = newval
        // this.form.deptId = newval
        this.getTreeselect()
      }
    }
  },
  created () {
    scanModeList().then(res => {
      if (res.code == 200) {
        this.optionsSmfs = res.data
      }
    })
    if (this.$store.state.deptId) {
      this.quer2.deptId = this.$store.state.deptId
      this.getTreeselect()
    }
  },
  methods: {
    //获取本地文件上传下标
    benFileIndex (index) {
      this.benUrlIndex = index
    },
    // 删除本地显示的升级文件
    deleteFileUrl (index) {
      this.benFileArr[index].fUuid = ''
      this.benFileArr[index].urlFileBen = ''
      this.benFileArr[index].isgjShowBen = false
    },
    // 删除服务器文件
    deleteFile () {
      let that = this
      this.$confirm('确定要删除选中的数据吗?', '警告', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function () {
        delMaterial(that.fFileIdArr).then(res => {
          if (res.code == 200) {
            that.radio1 = 0
            that.fFileIdArr = []
            that.dialogVisible = false
            that.msgSuccess('删除成功')
          }
        })
      })
    },
    ddssf () {
      this.dialogVisible1 = false
      let str =
        '0,' +
        this.extendArr[0].checks +
        ',3,' +
        this.extendArr[2].checks +
        ',' +
        this.extendArr[1].checks +
        ',' +
        this.extendArr[5].value +
        ',' +
        this.extendArr[3].checks +
        ',' +
        this.extendArr[6].value +
        ',0,' +
        this.extendArr[7].value +
        ',0,' +
        this.extendArr[8].value +
        ',' +
        this.extendArr[10].value +
        ',' +
        this.extendArr[4].checks +
        ',' +
        this.extendArr[9].value
      this.basicArr = str.split(',')
      for (let i = 0; i < this.basicArr.length; i++) {
        this.basicArr[i] = parseInt(this.basicArr[i])
      }
    },
    // 星级颜色数组
    starChange (index) {
      this.starColorArr = []
      for (let i = 0; i < index + 1; i++) {
        this.starColorArr.push(this.starcolorObj)
      }
    },
    // 星级颜色设置
    starColorBtn () {
      this.getSendArr()
      if (this.starColorArr.length == 5) {
        this.setUpBtn({
          cardList: this.query2.cardList,
          command: 178,
          params: this.starColorData
        })
      }
    },
    // 星级等级设置
    starArrBtn () {
      this.getSendArr()
      this.setUpBtn({
        cardList: this.query2.cardList,
        command: 179,
        lightCount: this.starObj.starValue
      })
    },
    // 报警
    callpolice () {},
    // 取消报警设置
    cancelpolice () {
      this.setUpBtn({
        cardList: this.query2.cardList,
        command: 177,
        state: 0
      })
    },
    // 空车颜色设置
    catBtn () {
      this.getSendArr()
      this.setUpBtn({
        cardList: this.query2.cardList,
        command: 180,
        statusColor: this.catColorData
      })
    },
    // 基本设置点击事件
    basicBtn () {
      this.getSendArr()
      let obj = {
        width: this.numWidth,
        height: this.numHeight,
        totalProgram: this.programNum,
        color: this.screenValue,
        oep: this.checked1 ? 1 : 0,
        dap: this.checked2 ? 1 : 0,
        nvertedByte: this.checked3 ? 1 : 0,
        sync: 0, //未知
        warning: 0, //未知
        sms: 0, //未知
        extend: this.checked4 ? this.basicArr : []
      }
      this.setUpBtn({
        cardList: this.query2.cardList,
        command: 21,
        params: obj
      })
    },
    // 扩展按钮的显示与隐藏
    isextend () {
      if (this.checked4 == false) {
        this.isextendConfig = false
      } else {
        this.isextendConfig = true
      }
    },
    // 扩展参数按钮
    extendConfig () {
      this.dialogVisible1 = true
    },
    // 扫描方式点击事件
    changeScanType (index) {
      this.scanConfig.scanType = this.optionsSmfs[index].scanType
      this.scanConfig.subScanType = this.optionsSmfs[index].subScanType
    },
    // 行消隐点击事件
    changeLineShadow (index) {
      this.scanConfig.lineShadow = index
    },
    // 行顺序点击事件
    changeRowOrder (index) {
      this.scanConfig.rowOrder = index
    },
    // 点阵点击事件
    changeRgOrder (index) {
      this.scanConfig.rgOrder = index
    },
    // 数据类型点击事件
    changeMirror (index) {
      this.scanConfig.mirror = index
    },
    // 138译码点击事件
    changeDecoding (index) {
      this.scanConfig.decoding = index
    },
    // 服务器类型点击事件
    changeServerType (index) {
      this.isA = false
      if (index == 0) {
        this.fwqDisabled = false
        this.dnsDisabled = true
        this.gprsConfig.inType = 0
      } else {
        this.fwqDisabled = true
        this.dnsDisabled = false
        this.gprsConfig.inType = 1
      }
    },
    // 亮度定时个数选择
    changeTime (index) {
      this.setTimeLength.lightInfos = []
      for (let i = 0; i < index + 1; i++) {
        let timeObj = {
          start: '',
          end: '',
          bright: 15
        }
        this.setTimeLength.lightInfos.push(timeObj)
      }
      if (index == 0) {
        this.setTimeLength.lightType = 1
      } else {
        this.setTimeLength.lightType = 0
      }
    },
    // 亮度时间判断
    judgeTime (index) {
      if (index > 0) {
        if (
          parseInt(
            this.setTimeLength.lightInfos[index].start.replace(':', '')
          ) <=
          parseInt(
            this.setTimeLength.lightInfos[index - 1].start.replace(':', '')
          )
        ) {
          this.$message({
            showClose: true,
            message:
              '第' + (index + 1) + '个时间不能小于或等于第' + index + '个时间',
            type: 'warning'
          })
          this.setTimeLength.lightInfos[index].start = ''
        }
      }
    },
    // 亮度设置点击事件
    brightnessBtn () {
      this.getSendArr()
      if (this.setTimeLength.lightType == 1) {
        this.setUpBtn({
          cardList: this.query2.cardList,
          command: 28,
          params: this.setTimeLength
        })
      } else {
        if (
          this.setTimeLength.lightInfos.findIndex(
            target => target.start == ''
          ) == -1
        ) {
          this.setUpBtn({
            cardList: this.query2.cardList,
            command: 28,
            params: this.setTimeLength
          })
        } else {
          this.$message({
            showClose: true,
            message: '当前存在空定时',
            type: 'warning'
          })
        }
      }
    },
    // 开关屏定时个数选择
    onoffchangeTime (index) {
      this.onoffTimeLength = []
      for (let i = 0; i < index + 1; i++) {
        let obj = {
          times: ''
        }
        this.onoffTimeLength.push(obj)
      }
    },
    // 开关屏时段判断
    onofftime (index) {
      if (index > 0) {
        if (
          parseInt(this.onoffTimeLength[index].times[0].replace(':', '')) <=
          parseInt(this.onoffTimeLength[index - 1].times[1].replace(':', ''))
        ) {
          this.$message({
            showClose: true,
            message:
              '第' +
              (index + 1) +
              '个开始时间不能小于或等于第' +
              index +
              '个结束时间',
            type: 'warning'
          })
          this.onoffTimeLength[index].times = ''
        }
      }
    },
    // 开关屏设置点击事件
    onoffBtn () {
      this.getSendArr()
      console.log(this.onoffTimeLength)
      let arr = []
      if (this.onoffTimeLength.findIndex(target => target.times == '') == -1) {
        for (let i = 0; i < this.onoffTimeLength.length; i++) {
          let obj = {
            start: this.onoffTimeLength[i].times[0],
            end: this.onoffTimeLength[i].times[1]
          }
          arr.push(obj)
        }
        this.setUpBtn({
          cardList: this.query2.cardList,
          command: 23,
          params: {
            timeInfos: arr
          }
        })
      } else {
        this.$message({
          showClose: true,
          message: '当前存在空时段',
          type: 'warning'
        })
      }
    },
    // 服务器升级文件
    serverFileOk () {
      if (this.fUuid) {
        this.query2.fUuid = this.fUuid
        this.dialogVisible = false
        this.urlFile = this.tiurlFile
        this.isgjShow = true
      } else {
        this.$message({
          showClose: true,
          message: '当前没有选择文件',
          type: 'warning'
        })
      }
    },
    radioChange (index) {
      this.isButton = false
      this.fUuid = this.binFileArr[index].fUuid
      this.tiurlFile = this.binFileArr[index].fDescription
      this.fFileIdArr[0] = this.binFileArr[index].fFileId
    },
    // 获取设备数组
    getSendArr () {
      this.query2.cardList = []
      this.$refs.tree.getCheckedNodes(true).forEach(item => {
        if (item.id.length > 8) {
          this.query2.cardList.push(item.id)
        }
      })
    },
    // 本地文件上传
    beforeBenUpload (file) {
      programsImg([file], this.quer2.deptId, 1, 100, 100).then(res => {
        if (res.code == 200) {
          console.log(res)
          this.benFileArr[this.benUrlIndex].urlFileBen = res.fileName
          this.benFileArr[this.benUrlIndex].fUuid = res.fUuid
          // this.query2.fUuid=res.fUuid
          this.benFileArr[this.benUrlIndex].isgjShowBen = true
          this.$message.success(res.msg)
        } else {
          this.$message.error(res.msg)
        }
      })
    },
    // 其他文件升级
    qitaBtn () {},
    // 历史文件接口
    historyBtn () {
      if (this.radio == '历史文件') {
        console.log(111)
      }
    },
    // 固件上传
    beforegjUpload (file) {
      programsImg([file], this.quer2.deptId, 1, 100, 100).then(res => {
        if (res.code == 200) {
          console.log(res)
          this.urlFile = res.fileName
          this.$message.success(res.msg)
          this.query2.fUuid = res.fUuid
          this.isgjShow = true
        } else {
          this.$message.error(res.msg)
        }
      })
      return false
    },
    // 字库上传
    beforezkUpload (file) {
      programsImg([file], this.quer2.deptId, 1, 100, 100).then(res => {
        if (res.code == 200) {
          // this.getMaterialList() //查询素材列表
          this.$message.success(res.msg)
          this.iszkShow = true
        } else {
          this.$message.error(res.msg)
        }
      })
      return false
    },
    // 查询部门下拉树结构
    getTreeselect () {
      getDev(this.quer2)
        .then(response => {
          // console.log(response.data)
          this.deptOptions = response.data
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 设置函数封装
    setUpBtn (obj) {
      if (this.query2.cardList.length == 0) {
        this.$message({
          showClose: true,
          message: '当前没有选择设备',
          type: 'warning'
        })
      } else {
        this.$confirm('为避免误操作，请再次确认', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(() => {
            cardSend(obj).then(res => {
              if (res.code == 200) {
                this.$message.success(res.msg)
              } else {
                this.$message.error(res.msg)
              }
            })
          })
          .catch(() => {
            this.$message({
              showClose: true,
              type: 'info',
              message: '已取消设置'
            })
          })
      }
    },
    // 操作设置
    operates () {
      this.getSendArr()
      console.log(this.value)
      if (this.value == '') {
        this.$message({
          showClose: true,
          message: '没有选择操作项',
          type: 'warning'
        })
      } else {
        this.setUpBtn({
          cardList: this.query2.cardList,
          command: this.value
          // params:{}
        })
      }
    },
    // 波特率设置
    btvBtn () {
      this.getSendArr()
      let reg = /^[0-9]{3}$/
      if (!reg.test(this.inputNum)) {
        console.log('不对')
      } else {
        this.setUpBtn({
          cardList: this.query2.cardList,
          command: 48,
          params: {
            address: this.inputNum,
            baudRate: this.valueBtl,
            waitTime: this.num
          }
        })
      }
    },
    // 扫描配置设置
    scanBtn () {
      this.getSendArr()
      this.setUpBtn({
        cardList: this.query2.cardList,
        command: 16,
        params: this.scanConfig
      })
    },
    // 服务器正则
    fwqReg () {
      let reg = /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/
      if (!reg.test(this.inputFwq)) {
        this.$message({
          showClose: true,
          message: '服务器格式不正确',
          type: 'warning'
        })
        this.isA = false
      } else {
        this.isA = true
      }
    },
    // 域名正则
    dnsReg () {
      let reg = /^(?=^.{3,255}$)(http(s)?:\/\/)?(www\.)?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:\d+)*(\/\w+\.\w+)*$/
      if (!reg.test(this.inputDns)) {
        this.$message({
          showClose: true,
          message: '域名格式不正确',
          type: 'warning'
        })
        this.isA = false
      } else {
        this.isA = true
      }
    },
    // 端口号正则
    dkhReg () {
      if (this.inputDkh < 4000 || this.inputDkh > 65536) {
        this.$message({
          showClose: true,
          message: '端口号格式不正确',
          type: 'warning'
        })
        this.isB = false
      } else {
        this.isB = true
      }
    },
    // gprs设置
    gprsBtn () {
      this.getSendArr()
      if (!this.isA) {
        this.$message({
          showClose: true,
          message: '服务器或域名格式不正确',
          type: 'warning'
        })
      } else if (!this.isB) {
        this.$message({
          showClose: true,
          message: '端口号格式不正确',
          type: 'warning'
        })
      } else {
        this.gprsConfig.domain = this.inputFwq //服务器IP
        this.gprsConfig.port = this.inputDkh //端口号
        this.gprsConfig.dns = this.inputDns //Dns
        this.gprsConfig.apn = this.inputApn //APN
        this.gprsConfig.userName = this.inputApnyh //用户
        this.gprsConfig.password = this.inputApnmm //密码
        if (this.checked == false) {
          this.gprsConfig.is4G = 0
        } else {
          this.gprsConfig.is4G = 1
        }
        this.setUpBtn({
          cardList: this.query2.cardList,
          command: 52,
          params: this.gprsConfig
        })
        console.log(this.gprsConfig)
      }
    },
    // 筛选节点
    filterNode (value, data, node) {
      if (!value) return true
	  return  node.checked==true ? node.checked==true : data.label.indexOf(value) !== -1
      // return data.label.indexOf(value) !== -1
    },
    // 节点单击事件获得树结构Id
    handleNodeClick (data) {
      // let card
      // console.log(11)
      // if (data.id.length > 8) {
      // 	card = data.id
      // }
    },
    // currDeptChange(val) {
    // 	this.quer2.deptId = val
    // 	this.getTreeselect()
    // },
    handleClick (tab, event) {
      // this.tabIndex=tab.index
      // if(this.tabIndex==0){
      // }
    },
    handleChange (file, fileList) {
      // this.fileList = fileList.slice(-3);
    },
    sendFile () {},
    // 升级固件
    sendgjFile () {
      this.query2.cardList = []
      this.$refs.tree.getCheckedNodes(true).forEach(item => {
        if (item.id.length > 8) {
          this.query2.cardList.push(item.id)
        }
      })
      if (this.query2.cardList.length == 0) {
        this.$message({
          showClose: true,
          message: '请选择需要升级的设备',
          type: 'warning'
        })
      } else if (this.query2.fUuid == '') {
        this.$message({
          showClose: true,
          message: '请选择升级文件',
          type: 'warning'
        })
      } else {
        this.$alert('确定要升级选中设备吗', {
          confirmButtonText: '确定',
          callback: action => {
            console.log(this.query2)
            cardSend({
              cardList: this.query2.cardList,
              command: 65,
              params: {
                fUuid: this.query2.fUuid
              }
            }).then(res => {
              if (res.code == 200) {
                this.$message.success(res.msg)
              } else {
                this.$message.error(res.msg)
              }
            })
          }
        })
      }
    },
    handleTimeChange (value) {
      console.log(value)
    },
    // 根据传入的数据获取对应文件列表
    serverFile (index) {
      this.dialogVisible = true
      if (index == 1) {
        this.fileTitle = '固件文件列表'
        getMaterial(this.quer2).then(res => {
          if (res.code == 200) {
            console.log(res.rows)
            this.binFileArr = res.rows
          }
        })
      } else {
        this.fileTitle = '字库文件列表'
      }
    }
    // handleClose(done) {
    //         this.$confirm('确认关闭？')
    //           .then(_ => {
    //             done();
    //           })
    //           .catch(_ => {});
    // },
    // handleClose1(done) {
    //         this.$confirm('确认关闭？')
    //           .then(_ => {
    //             done();
    //           })
    //           .catch(_ => {});
    // }
  }
}
</script>

<style lang="scss" scoped="scoped">
.container {
  ::v-deep.el-upload-list__item:first-child {
    position: absolute;
    top: 0;
    left: 0;
    // display: none;
  }
  ::v-deep.el-card__body {
    padding: 5px 2px;
    .el-scrollbar__bar.is-horizontal {
      height: 12px;
    }
  }
  ::v-deep.mytree {
    position: relative;
    .el-dialog__header {
      background: cadetblue;
      text-align: left;
    }

    .el-dialog__footer {
      position: absolute;
      top: 0;
      right: 50px;
    }

    .el-dialog__body {
      height: 650px;
      padding: 10px 30px;

      .el-tree {
        padding: 10px;
        height: 100%;
        overflow: scroll;

        .el-tree-node {
          height: 100%;

          .el-tree-node__content {
            height: 18px;
          }
        }
      }
    }
  }

  .devList-top {
    height: 40px;
    display: flex;
    align-items: center;
    padding: 3px;

    span {
      color: #fff;
      font-weight: 700;
      width: 120px;
    }

    .el-col {
      width: 19%;
      top: 12px;
      left: 12px;
      z-index: 999;
      position: absolute;
    }
  }

  .confCss {
    width: 100%;
    height: 80vh;
    background-color: #a7c0dc;
    padding: 10px 10px;
    overflow: auto;

    .configBox {
      width: 100%;
      padding: 10px;
      border: 2px solid #286090;
      position: relative;
      margin-top: 5px;

      .titleLei {
        position: absolute;
        padding: 3px 15px;
        border-radius: 30px;
        background-color: #286090;
        color: #fff;
        font-weight: 700;
        top: -15px;
        left: -2px;
      }

      .divBox {
        margin-top: 5px;
        width: 100%;
        position: relative;
        background-color: darkgray;
        border-radius: 5px;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        justify-content: flex-start;
        padding: 5px;
        font-weight: 700;
        color: #fff;

        .upload-demo {
          .el-button {
            // font-weight: 700;
            font-size: 14px;
          }
        }

        .sendBtn {
          padding: 9px 10px;
          // font-weight: 700;
        }
      }

      .divBox2 {
        margin-top: 5px;
        width: 100%;
        position: relative;
        background-color: darkgray;
        border-radius: 5px;
        padding: 5px;
        font-weight: 700;
        color: #fff;
      }

      .btlv {
        flex-wrap: wrap;
        align-content: flex-start;

        p {
          width: 100%;
          margin: 0;
          margin-top: 10px;

          span {
            width: 70px;
            display: inline-block;
            text-align: right;
          }

          .el-input {
            width: 65%;
            margin-left: 20px;
          }

          .el-input-number {
            width: 40%;
            margin-left: 20px;
          }

          .el-button {
            margin-left: 20px;
          }
        }
      }
    }

    .configRightBottom {
      position: absolute;
      width: 60%;
      right: 10px;
      top: 12px;

      .divBox {
        width: 100%;

        p {
          margin: 0;
          margin-top: 10px;
          width: 100%;

          span {
            width: 90px;
          }
        }
      }
    }

    .screenBasic {
      width: 80%;
      margin: 15px auto;
      padding: 10px 10px;

      .el-checkbox {
        color: #fff;
        width: 12%;
        font-weight: 700;
      }

      .el-input-number {
        width: 15%;
        margin-left: 10px;
      }

      .el-input {
        width: 15%;
        margin-left: 5px;
      }

      .ulbox {
        width: 100%;
        padding: 5px;
        border-radius: 10px;
        color: #fff;
        background-color: darkgray;

        li {
          margin-top: 5px;
        }
      }

      .timeBox {
        width: 100%;
        margin-top: 10px;
        padding: 10px;
        border-radius: 10px;
        color: #fff;
        background-color: darkgray;
      }
    }
  }
}
</style>
